package controlLayer;
import modelLayer.DVDContainer;
import modelLayer.DVD;
import modelLayer.Copy;
/**
 * Write a description of class DvdCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class DvdCtr
{
    private DVDContainer container;
    public DvdCtr()
    {
        container = DVDContainer.getInstance();
    }
    
    public void createDVD(String barcode, String title, String artist, String publishDate)
    {
        DVD dvd = new DVD(barcode, title, artist, publishDate);
        container.addDVD(dvd);
    }
    
    public void updateDVD(DVD dvd, String barcode, String title, String artist, String publishDate)
    {
        dvd.setBarcode(barcode);
        dvd.setTitle(title);
        dvd.setArtist(artist);
        dvd.setPublishDate(publishDate);
    }
    
    public DVD getDVD(String title)
    {
        return container.findDVD(title);
    }
    
    public void deleteDVD(DVD dvd)
    {
        container.removeDVD(dvd);
    }
    
    public void addCopyToDVD(String serialNumber, String purchaseDate, double purchasePrice, DVD dvd)
    {
       Copy copy = new Copy(serialNumber, purchaseDate, purchasePrice, dvd);
       
       dvd.addCopy(copy);
    }
}
